home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Sound / LAME / WarpOS / src / Dll / BladeMP3EncDLL.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-06-12  |  6.1 KB  |  250 lines

  1. /*
  2.  * Blade DLL Interface for LAME.
  3.  *
  4.  * Copyright (c) 1999 A.L. Faber
  5.  * Based on bladedll.h version 1.0 written by Jukka Poikolainen
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2 of the License, or (at your option) any later version.
  11.  * 
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the
  19.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.  * Boston, MA  02111-1307, USA.
  21.  */
  22.  
  23. #ifndef ___BLADEDLL_H_INCLUDED___
  24. #define ___BLADEDLL_H_INCLUDED___
  25.  
  26. #pragma pack(push)
  27. #pragma pack(1)
  28.  
  29. /* encoding formats */
  30.  
  31. #define        BE_CONFIG_MP3            0                                        
  32. #define        BE_CONFIG_LAME            256        
  33.  
  34. /* type definitions */
  35.  
  36. typedef        unsigned long            HBE_STREAM;
  37. typedef        HBE_STREAM                *PHBE_STREAM;
  38. typedef        unsigned long            BE_ERR;
  39.  
  40. /* error codes */
  41.  
  42. #define        BE_ERR_SUCCESSFUL                    0x00000000
  43. #define        BE_ERR_INVALID_FORMAT                0x00000001
  44. #define        BE_ERR_INVALID_FORMAT_PARAMETERS    0x00000002
  45. #define        BE_ERR_NO_MORE_HANDLES                0x00000003
  46. #define        BE_ERR_INVALID_HANDLE                0x00000004
  47. #define        BE_ERR_BUFFER_TOO_SMALL                0x00000005
  48.  
  49. /* other constants */
  50.  
  51. #define        BE_MAX_HOMEPAGE            128
  52.  
  53. /* format specific variables */
  54.  
  55. #define        BE_MP3_MODE_STEREO        0
  56. #define        BE_MP3_MODE_JSTEREO        1
  57. #define        BE_MP3_MODE_DUALCHANNEL    2
  58. #define        BE_MP3_MODE_MONO        3
  59.  
  60.  
  61.  
  62. #define        MPEG1    1
  63. #define        MPEG2    0
  64.  
  65. #ifdef _BLADEDLL
  66. #undef FLOAT
  67.     #include <Windows.h>
  68. #endif
  69.  
  70. #define CURRENT_STRUCT_VERSION 1
  71. #define CURRENT_STRUCT_SIZE sizeof(BE_CONFIG)    // is currently 331 bytes
  72.  
  73. /* OBSOLETE, VALUES STILL WORK
  74. typedef enum 
  75. {
  76.     NORMAL_QUALITY=0,
  77.     LOW_QUALITY,
  78.     HIGH_QUALITY,
  79.     VOICE_QUALITY
  80. } LAME_QUALTIY_PRESET;
  81.  
  82. */
  83.  
  84.  
  85. typedef enum
  86. {
  87.     VBR_METHOD_NONE            = -1,
  88.     VBR_METHOD_DEFAULT        =  0,
  89.     VBR_METHOD_OLD            =  1,
  90.     VBR_METHOD_NEW            =  2,
  91.     VBR_METHOD_MTRH            =  3,
  92.     VBR_METHOD_ABR            =  4
  93. } VBRMETHOD;
  94.  
  95. typedef enum 
  96. {
  97.     LQP_NOPRESET=-1,
  98.  
  99.     // QUALITY PRESETS
  100.     LQP_NORMAL_QUALITY=0,
  101.     LQP_LOW_QUALITY,
  102.     LQP_HIGH_QUALITY,
  103.     LQP_VOICE_QUALITY,
  104.     LQP_R3MIX_QUALITY,
  105.  
  106.     // NEW PRESET VALUES
  107.     LQP_PHONE    =1000,
  108.     LQP_SW        =2000,
  109.     LQP_AM        =3000,
  110.     LQP_FM        =4000,
  111.     LQP_VOICE    =5000,
  112.     LQP_RADIO    =6000,
  113.     LQP_TAPE    =7000,
  114.     LQP_HIFI    =8000,
  115.     LQP_CD        =9000,
  116.     LQP_STUDIO    =10000
  117.  
  118. } LAME_QUALTIY_PRESET;
  119.  
  120.  
  121.  
  122. typedef struct    {
  123.     DWORD    dwConfig;            // BE_CONFIG_XXXXX
  124.                                 // Currently only BE_CONFIG_MP3 is supported
  125.     union    {
  126.  
  127.         struct    {
  128.  
  129.             DWORD    dwSampleRate;    // 48000, 44100 and 32000 allowed
  130.             BYTE    byMode;            // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
  131.             WORD    wBitrate;        // 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256 and 320 allowed
  132.             BOOL    bPrivate;        
  133.             BOOL    bCRC;
  134.             BOOL    bCopyright;
  135.             BOOL    bOriginal;
  136.  
  137.             } mp3;                    // BE_CONFIG_MP3
  138.  
  139.             struct
  140.             {
  141.             // STRUCTURE INFORMATION
  142.             DWORD            dwStructVersion;    
  143.             DWORD            dwStructSize;
  144.  
  145.             // BASIC ENCODER SETTINGS
  146.             DWORD            dwSampleRate;    // SAMPLERATE OF INPUT FILE
  147.             DWORD            dwReSampleRate;    // DOWNSAMPLERATE, 0=ENCODER DECIDES  
  148.             LONG            nMode;            // BE_MP3_MODE_STEREO, BE_MP3_MODE_DUALCHANNEL, BE_MP3_MODE_MONO
  149.             DWORD            dwBitrate;        // CBR bitrate, VBR min bitrate
  150.             DWORD            dwMaxBitrate;    // CBR ignored, VBR Max bitrate
  151.             LONG            nPreset;        // Quality preset, use one of the settings of the LAME_QUALITY_PRESET enum
  152.             DWORD            dwMpegVersion;    // FUTURE USE, MPEG-1 OR MPEG-2
  153.             DWORD            dwPsyModel;        // FUTURE USE, SET TO 0
  154.             DWORD            dwEmphasis;        // FUTURE USE, SET TO 0
  155.  
  156.             // BIT STREAM SETTINGS
  157.             BOOL            bPrivate;        // Set Private Bit (TRUE/FALSE)
  158.             BOOL            bCRC;            // Insert CRC (TRUE/FALSE)
  159.             BOOL            bCopyright;        // Set Copyright Bit (TRUE/FALSE)
  160.             BOOL            bOriginal;        // Set Original Bit (TRUE/FALSE)
  161.             
  162.             // VBR STUFF
  163.             BOOL            bWriteVBRHeader;    // WRITE XING VBR HEADER (TRUE/FALSE)
  164.             BOOL            bEnableVBR;            // USE VBR ENCODING (TRUE/FALSE)
  165.             INT                nVBRQuality;        // VBR QUALITY 0..9
  166.             DWORD            dwVbrAbr_bps;        // Use ABR in stead of nVBRQuality
  167.             VBRMETHOD        nVbrMethod;
  168.             BOOL            bNoRes;                // Disable Bit resorvoir
  169.  
  170.             BYTE            btReserved[255-3*sizeof(DWORD)];    // FUTURE USE, SET TO 0
  171.  
  172.             } LHV1;                    // LAME header version 1
  173.  
  174.         struct    {
  175.  
  176.             DWORD    dwSampleRate;
  177.             BYTE    byMode;
  178.             WORD    wBitrate;
  179.             BYTE    byEncodingMethod;
  180.  
  181.         } aac;
  182.  
  183.     } format;
  184.         
  185. } BE_CONFIG, *PBE_CONFIG;
  186.  
  187.  
  188. typedef struct    {
  189.  
  190.     // BladeEnc DLL Version number
  191.  
  192.     BYTE    byDLLMajorVersion;
  193.     BYTE    byDLLMinorVersion;
  194.  
  195.     // BladeEnc Engine Version Number
  196.  
  197.     BYTE    byMajorVersion;
  198.     BYTE    byMinorVersion;
  199.  
  200.     // DLL Release date
  201.  
  202.     BYTE    byDay;
  203.     BYTE    byMonth;
  204.     WORD    wYear;
  205.  
  206.     // BladeEnc    Homepage URL
  207.  
  208.     CHAR    zHomepage[BE_MAX_HOMEPAGE + 1];    
  209.  
  210.     BYTE    byAlphaLevel;
  211.     BYTE    byBetaLevel;
  212.     BYTE    byMMXEnabled;
  213.  
  214.     BYTE    btReserved[125];
  215.  
  216.  
  217. } BE_VERSION, *PBE_VERSION;            
  218.  
  219. #ifndef _BLADEDLL
  220.  
  221. typedef BE_ERR    (*BEINITSTREAM)            (PBE_CONFIG, PDWORD, PDWORD, PHBE_STREAM);
  222. typedef BE_ERR    (*BEENCODECHUNK)        (HBE_STREAM, DWORD, PSHORT, PBYTE, PDWORD);
  223. typedef BE_ERR    (*BEDEINITSTREAM)        (HBE_STREAM, PBYTE, PDWORD);
  224. typedef BE_ERR    (*BECLOSESTREAM)        (HBE_STREAM);
  225. typedef VOID    (*BEVERSION)            (PBE_VERSION);
  226. typedef VOID    (*BEWRITEVBRHEADER)        (LPCSTR);
  227.  
  228. #define    TEXT_BEINITSTREAM        "beInitStream"
  229. #define    TEXT_BEENCODECHUNK        "beEncodeChunk"
  230. #define    TEXT_BEDEINITSTREAM        "beDeinitStream"
  231. #define    TEXT_BECLOSESTREAM        "beCloseStream"
  232. #define    TEXT_BEVERSION            "beVersion"
  233. #define    TEXT_BEWRITEVBRHEADER    "beWriteVBRHeader"
  234.  
  235. #else
  236.  
  237. __declspec(dllexport) BE_ERR    beInitStream(PBE_CONFIG pbeConfig, PDWORD dwSamples, PDWORD dwBufferSize, PHBE_STREAM phbeStream);
  238. __declspec(dllexport) BE_ERR    beEncodeChunk(HBE_STREAM hbeStream, DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput);
  239. __declspec(dllexport) BE_ERR    beDeinitStream(HBE_STREAM hbeStream, PBYTE pOutput, PDWORD pdwOutput);
  240. __declspec(dllexport) BE_ERR    beCloseStream(HBE_STREAM hbeStream);
  241. __declspec(dllexport) VOID        beVersion(PBE_VERSION pbeVersion);
  242. __declspec(dllexport) BE_ERR    beWriteVBRHeader(LPCSTR lpszFileName);
  243.  
  244.  
  245. #endif
  246.  
  247. #pragma pack(pop)
  248.  
  249. #endif
  250.